package com.lie.prepare.multi_thread.join;

/**
 * Created by lie on 2018/4/9.
 */
public class Joiner extends Thread {

    private Sleeper sleeper;

    public Joiner(String name, Sleeper sleeper) {
        super(name);
        this.sleeper = sleeper;
        start();
    }

    @Override
    public void run() {

        try {
            sleeper.join();
        } catch (InterruptedException e) {
            System.out.println(getName() + "主线程，join了sleeper，等待sleeper结束时被打断");
        }
        System.out.println(getName() + "** 主线程，join了sleeper，等待sleeper完成");
    }
}
